<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>盒模型</title>
  <style type="text/css">
    #div1{
      width: 100px;
      padding: 10px;
      border: 1px sloid #ccc;
      margin: 10px;
      /* box-sizing: border-box; */
      background-color: gold;
    }
  </style>
</head>
<body>
  <div id="div1">
    this is div1
  </div>  

  <ul>
    <li>offsetWidth = (内容宽度 + 内边距 + 边框)</li>
    <li>设置 box-sizing: border-box 可以让 offsetWith 等于 width</li>
  </ul>
</body>
</html>